package com.swanclouds.redfish.managers.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.DeviceEntity;

import java.util.List;
import java.util.Map;

/**
 * @author 李文强
 * description:
 */

public class SyslogServiceModel implements DeviceEntity {

    //syslog资源的访问路径
    @JsonProperty("@odata.id")
    private String dataId;

    //syslog资源模型的OData描述信息
    @JsonProperty("@odata.context")
    private String context;

    //syslog资源的类型
    @JsonProperty("@odata.type")
    private String type;

    //syslog资源的ID
    @JsonProperty("Id")
    private String id;

    //syslog资源的名称
    @JsonProperty("Name")
    private String name;

    //Syslog服务器成员编号
    @JsonProperty("MemberId")
    private Integer memberId;

    //syslog服务使能
    @JsonProperty("ServiceEnabled")
    private String serviceEnabled;

    /**
     * 主机标识
     * ● BoardSN
     * ● ProductAssetTag
     * ● HostName
     */
    @JsonProperty("ServerIdentitySource")
    private String serverIdentitySource;

    /**
     * 告警级别
     * ● Critical （紧急）
     * ● Major （严重及以上）
     * ● Minor （轻微及以上）
     * ● Normal （正常及以上）
     * ● null （不发送告警）
     */
    @JsonProperty("AlarmSeverity")
    private String alarmSeverity;

    /**
     * 传输协议
     * ● UDP
     * ● TCP
     * ● TLS
     */
    @JsonProperty("TransmissionProtocol")
    private String transmissionProtocol;

    /**
     * 认证模式
     * ● OneWay
     * ● TwoWay
     */
    @JsonProperty("AuthenticateMode")
    private String authenticateMode;

    //根证书信息
    @JsonProperty("RootCertificate")
    private Map<String,Object> rootCertificate;

    //本地证书信息
    @JsonProperty("ClientCertificate")
    private Map<String,Object> clientCertificate;

    //Syslog服务器
    @JsonProperty("SyslogServers")
    private List<Map<String,Object>> syslogServers;

    //Syslog资源的action相关操作
    @JsonProperty("Actions")
    private Map<String,Object> actions;

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getServiceEnabled() {
        return serviceEnabled;
    }

    public void setServiceEnabled(String serviceEnabled) {
        this.serviceEnabled = serviceEnabled;
    }

    public String getServerIdentitySource() {
        return serverIdentitySource;
    }

    public void setServerIdentitySource(String serverIdentitySource) {
        this.serverIdentitySource = serverIdentitySource;
    }

    public String getAlarmSeverity() {
        return alarmSeverity;
    }

    public void setAlarmSeverity(String alarmSeverity) {
        this.alarmSeverity = alarmSeverity;
    }

    public String getTransmissionProtocol() {
        return transmissionProtocol;
    }

    public void setTransmissionProtocol(String transmissionProtocol) {
        this.transmissionProtocol = transmissionProtocol;
    }

    public String getAuthenticateMode() {
        return authenticateMode;
    }

    public void setAuthenticateMode(String authenticateMode) {
        this.authenticateMode = authenticateMode;
    }

    public Map<String, Object> getRootCertificate() {
        return rootCertificate;
    }

    public void setRootCertificate(Map<String, Object> rootCertificate) {
        this.rootCertificate = rootCertificate;
    }

    public Map<String, Object> getClientCertificate() {
        return clientCertificate;
    }

    public void setClientCertificate(Map<String, Object> clientCertificate) {
        this.clientCertificate = clientCertificate;
    }

    public List<Map<String, Object>> getSyslogServers() {
        return syslogServers;
    }

    public void setSyslogServers(List<Map<String, Object>> syslogServers) {
        this.syslogServers = syslogServers;
    }

    public Map<String, Object> getActions() {
        return actions;
    }

    public void setActions(Map<String, Object> actions) {
        this.actions = actions;
    }

    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public void setMemberId(Integer memberId) {
        this.memberId = memberId;
    }

    public Integer getMemberId() {
        return memberId;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "SyslogServiceModel{" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", serviceEnabled='" + serviceEnabled + '\'' +
                ", serverIdentitySource='" + serverIdentitySource + '\'' +
                ", AlarmSeverity='" + alarmSeverity + '\'' +
                ", TransmissionProtocol='" + transmissionProtocol + '\'' +
                ", AuthenticateMode='" + authenticateMode + '\'' +
                ", rootCertificate=" + rootCertificate +
                ", clientCertificate=" + clientCertificate +
                //", syslogServers=" + Arrays.toString(syslogServers) +
                ", actions=" + actions +
                '}';
    }
}
